<?php
/**
 * Created by PhpStorm.
 * User: t
 * Date: 2024/3/21
 * Time: 17:13
 */

namespace app\merchant\controller;

use app\Request;

class Config
{
    public function index()
    {
        $configModel = new \app\home\model\Config();
        $configList = $configModel->select()->toArray();
        $configList = array_column($configList, 'value', 'key');
        return success('配置', $configList);
    }

    public function upConfig(Request $request)
    {
        $param = $request->param();
        $configModel = new \app\home\model\Config();
        foreach ($param as $key => $value) {
            $configModel->where(['key' => $key])->update(['value' => $value]);
        }
        return success('修改成功');
    }
}